package com.cy.controller;

import java.io.UnsupportedEncodingException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cy.common.vo.BrandList;
import com.cy.common.vo.CategoryList;
import com.cy.common.vo.GoodsList;
import com.cy.common.vo.JsonResult;
import com.cy.common.vo.PageObject;
import com.cy.entity.SysGoodsInfo;
import com.cy.service.SysGoodsListService;

/**  
 * @Title:  SysGoodsListController.java   
 * @Package com.cy.controller   
 * @Description:    描述   
 * @author: ZHANGSIMIN     
 * @date:   2019年10月20日 下午4:14:26   
 * @version V1.0 
 */
@Controller
@RequestMapping("/GoodsList/")
public class SysGoodsListController {
	
	@Autowired
	private SysGoodsListService sysGoodsListService;
	
	@RequestMapping("doGetGoodsListByType")
	@ResponseBody
	public JsonResult doGetGoodsListByType(String type,Integer id,Integer page,String s,HttpServletRequest request) throws UnsupportedEncodingException {
		request.setCharacterEncoding("utf-8");
		PageObject<GoodsList> goodsListByType = sysGoodsListService.getGoodsListByType(type,id,page,s);
		return new JsonResult(goodsListByType);
	}
	
	@RequestMapping("getBrandList")
	@ResponseBody
	public JsonResult getBrandList(String type,Integer id) {
		List<BrandList> brandList = sysGoodsListService.getBrandList(type, id);
		return new JsonResult(brandList);
	}
	
	@RequestMapping("getCateList")
	@ResponseBody
	public JsonResult getCateList(Integer id) {
		List<CategoryList> cateList = sysGoodsListService.getCateList(id);
		return new JsonResult(cateList);
	}
}
